package team.pwy.pojo.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.DateFormat;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.io.Serializable;
import java.util.Date;

@JsonIgnoreProperties(ignoreUnknown = true)
// indexName: 索引名字  createIndex: 用于指定当索引不存在时是否创建索引
@Document(indexName = "movie_index", createIndex = false)
@Data
@AllArgsConstructor
@NoArgsConstructor
public class MovieIndex implements Serializable {

    @Id
    private Integer id;

    @Field(type= FieldType.Text,analyzer = "ik_max_word", searchAnalyzer = "ik_smart")
    private String title;

    @Field(type= FieldType.Text)
    private String posterImg;

    @Field(type= FieldType.Text)
    private String language;

    @Field(type= FieldType.Text)
    private String director;

    @Field(type= FieldType.Keyword)
    private String country;
    @Field(type= FieldType.Keyword)
    private Float duration;
    @Field(type= FieldType.Date)
    private Date firstDate;
    @Field(type= FieldType.Text)
    private String content;
    @Field(type= FieldType.Long)
    private Long numbers;
    @Field(type= FieldType.Keyword)
    private double score;
    @Field(type= FieldType.Keyword)
    private double grossed;
    @Field(type= FieldType.Keyword)
    private String status;
    @Field(type= FieldType.Integer)
    private Integer swiper;
    @Field(type= FieldType.Double)
    private double price;
    @Field(type= FieldType.Integer)
    private Integer recommend;
    @Field(type= FieldType.Integer)
    private Integer desire;
    @Field(type= FieldType.Date)
    private Date createTime;
}
